package oop.core.item;
import oop.core.entity.*;

/**
 * 
 *Requirement for Interactive Item
 *
 */
public class Requirements
{
	private Stats requiredStats;
	private String[] requiredItems;
	
	/**
	 * Requirements constructor
	 * @param requiredStats
	 * @param requiredItems
	 */
	public Requirements(Stats requiredStats, String[] requiredItems)
	{
		this.requiredStats = requiredStats;
		this.requiredItems = requiredItems;
	}
	
	/**
	 * get/set methods for requiredStats and requiredItems
	 */
	public Stats getRequiredStats() 
	{
		return requiredStats;
	}

	public void setRequiredStats(Stats requiredStats) 
	{
		this.requiredStats = requiredStats;
	}

	public String[] getRequiredItems() 
	{
		return requiredItems;
	}

	public void setRequiredItems(String[] requiredItems) 
	{
		this.requiredItems = requiredItems;
	}
	
	public boolean areStatRequirementsMet(Stats stats)
	{
		 if((requiredStats.getAgility() > stats.getAgility()))
		 {
			 return false;
		 }
		 if ((requiredStats.getStrength() > stats.getStrength()))
		 {
			 return false;
		 }
		 if ((requiredStats.getIntellect() > stats.getIntellect()))
		 {
			 return false;
		 }
		 if ((requiredStats.getHardiness() >stats.getHardiness()))
		 {
			 return false;
		 }
		 if ((requiredStats.getMP() > stats.getMP()))
		 {
			 return false;
		 }
		 if ((requiredStats.getHP() > stats.getHP()))
		 {
			 return false;
		 }
		 if ((requiredStats.getEXP() > stats.getEXP()))
		 {
			 return false;
		 }
		 if ((requiredStats.getLives() > stats.getLives()))
		 {
			 return false;
		 }
		 
		 return true;
	}
	
	public boolean areItemRequirementsMet(Inventory inventory)
	{
		for(int i = 0; i < requiredItems.length; i++)
		{
			if(!(inventory.hasItem(requiredItems[i])))
			{
				return false;
			}	
		}
		return true;
	}
	

}
